import {geRedPkgRecord} from 'config/api'
export default {
  namespace: 'redPkgRecord',
  state:{
    myRecord: {},
    redPkg: {}
  },
  effects:{
    *geRedPkgRecordEff(action,{call,put,select}){
      let id = yield select(state => state.redPkgList.currentRedPkg.id)
     let {myRecord,redPkg} = yield call(geRedPkgRecord, id)
     yield put({
       type: 'save',
       payload: {myRecord,redPkg}
     })
    }
  },
  reducers:{
    save(state,{payload}){
      return {...state,...payload}
    }
  }
}
